var { initObj, formatObj } = require('../libs/common');

var init = function (data) {
    return initObj(mod, data);
}

var format = function (data) {
    return formatObj(mod, data);
}

// 消息记录表
var mod = {
    pcode: {
        name: '接收用户code',
        type: 'string',
        length: 12
    },
    phone:{
        name: '用户手机号',
        type: 'string',
        length: 100
    },
    openid:{
        name: '用户openid',
        type: 'string',
        length: 100
    },
    sendurl:{
        name: '发送消息地址',
        type: 'string',
        length: 100
    },
    template_id:{
        name: '消息模板id',
        type: 'string',
        length: 100
    },
    msg: {
        name: '消息内容',
        type: 'string',
        length: 5000
    },
    type: {
        name: '消息类型 如：系统、推荐、审核、申请',
        type: 'string',
        length: 50
    },
    mode: {
        name: '发送方式，短信、消息',
        type: 'string',
        default:'消息',
        length: 50
    },
    issend: {
        name: '是否发送成功',
        type: 'number',
        default: 0
    },
    bizid:{
        name: '回执id',
        type: 'string'
    },
    remark:{
        name: '备注',
        type: 'number',
        default: '自动发送'
    },
    errmsg:{
        name: '失败原因',
        type: 'string',
        length: 500
    },
    createtime: {
        name: '创建时间',
        type: 'date',
        default: new Date()
    },
    updatetime: {
        name: '更新时间',
        type: 'date',
        default: new Date()
    }
};

module.exports = {
    init,
    format
};